home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1996 June / macformat-038.iso / Demos / Notting Hill / ATHLETICS / COMMNT / 00156.ls < prev    next >
Encoding:
Text File  |  1996-02-08  |  10.0 KB  |  349 lines

  1. on decode ActionList
  2.   global GfxChannel, SeqChannel, DVidChannel, PauseFor, AutoVidC, aChannel, AutoVidX, AutoVidY, NewScreenID, CurrScreenID, AllScreen, first
  3.   put "Decoding..."
  4.   put ActionList
  5.   set PauseFor to 60
  6.   repeat with e in ActionList
  7.     put "current decode.." & e
  8.     if listp(e) then
  9.       set FBcommand to getAt(e, 1)
  10.       if FBcommand = "NAV" then
  11.         set AutoVidC to 0
  12.         set NewScreenID to getAt(e, 2)
  13.         if count(e) > 2 then
  14.           set AutoVidX to 320
  15.           set AutoVidY to 240
  16.           set AutoVidC to getAt(e, 3)
  17.           if count(e) > 3 then
  18.             set AutoVidX to getAt(e, 4)
  19.             set AutoVidY to getAt(e, 5)
  20.           end if
  21.         end if
  22.       else
  23.         if FBcommand = "PLAY" then
  24.           set locCurrScreen to CurrScreenID
  25.           set HoldAll to AllScreen
  26.           set DirMov to getAt(e, 2)
  27.           if count(e) > 2 then
  28.             set FrameIn to getAt(e, 3)
  29.             put "play frame FrameIn of movie DirMov " & FrameIn & " + " & DirMov
  30.           else
  31.             put "play movie DirMov " & DirMov
  32.             play movie DirMov
  33.           end if
  34.           set NewScreenID to locCurrScreen
  35.           set first to 1
  36.           set AllScreen to HoldAll
  37.         else
  38.           if (FBcommand = "GFX") or (FBcommand = "GFXP") then
  39.             set PicC to getAt(e, 2)
  40.             if count(e) > 2 then
  41.               set PicX to getAt(e, 3)
  42.               set PicY to getAt(e, 4)
  43.             else
  44.               set PicX to 320
  45.               set PicY to 240
  46.             end if
  47.             set IsP to FBcommand = "GFXP"
  48.             playGfx(PicC, PicX, PicY, IsP)
  49.             if FBcommand = "GFX" then
  50.               resetGfx()
  51.             end if
  52.           else
  53.             if FBcommand = "PAUSE" then
  54.               set PauseFor to getAt(e, 2)
  55.             else
  56.               if FBcommand = "SEQ" then
  57.                 playSeq(e)
  58.               else
  59.                 if FBcommand = "SND" then
  60.                   set SndCast to getAt(e, 2)
  61.                   puppetSound(string(SndCast))
  62.                 else
  63.                   if FBcommand = "VID" then
  64.                     set VidC to getAt(e, 2)
  65.                     if count(e) > 2 then
  66.                       set VidX to getAt(e, 3)
  67.                       set VidY to getAt(e, 4)
  68.                     else
  69.                       set VidX to 320
  70.                       set VidY to 240
  71.                     end if
  72.                     playVideo(VidC, VidX, VidY)
  73.                   end if
  74.                 end if
  75.               end if
  76.             end if
  77.           end if
  78.         end if
  79.       end if
  80.       next repeat
  81.     end if
  82.     if stringp(e) then
  83.       if e = "END" then
  84.         exit repeat
  85.       else
  86.         if e = "UPS" then
  87.           updateStage()
  88.         else
  89.           if e = "SEQCLR" then
  90.             resetSeq()
  91.           else
  92.             if e = "QUIT" then
  93.               DePuppetAll()
  94.               play done
  95.             else
  96.               put "unexpected string command"
  97.             end if
  98.           end if
  99.         end if
  100.       end if
  101.       next repeat
  102.     end if
  103.     put "Unexpected element in Feedback List"
  104.   end repeat
  105. end
  106.  
  107. on DePuppetAll
  108.   repeat with J = 1 to 48
  109.     puppetSprite(J, 0)
  110.   end repeat
  111. end
  112.  
  113. on playSeq SeqElement
  114.   global SeqChannel, PauseFor
  115.   set StartCast to getAt(SeqElement, 2)
  116.   set EndCast to getAt(SeqElement, 3)
  117.   if count(SeqElement) > 3 then
  118.     set SeqX to getAt(SeqElement, 4)
  119.     set SeqY to getAt(SeqElement, 5)
  120.   else
  121.     set SeqX to 320
  122.     set SeqY to 240
  123.   end if
  124.   set the locH of sprite SeqChannel to SeqX
  125.   set the locV of sprite SeqChannel to SeqY
  126.   set TimeGap to PauseFor
  127.   put "Time Gap =  " & PauseFor
  128.   put "Start " & StartCast & " to " & EndCast
  129.   if StartCast < EndCast then
  130.     repeat with M = StartCast to EndCast
  131.       set the castNum of sprite SeqChannel to M
  132.       updateStage()
  133.       delaytime(TimeGap)
  134.     end repeat
  135.   else
  136.     repeat with M = StartCast down to EndCast
  137.       set the castNum of sprite SeqChannel to M
  138.       updateStage()
  139.       delaytime(TimeGap)
  140.     end repeat
  141.   end if
  142. end
  143.  
  144. on delaytime aDelay
  145.   startTimer()
  146.   repeat while the timer < aDelay
  147.   end repeat
  148. end
  149.  
  150. on playGfx PicCast, PicX, PicY, IsP
  151.   global GfxChannel, PauseFor
  152.   set the castNum of sprite GfxChannel to PicCast
  153.   set the locH of sprite GfxChannel to PicX
  154.   set the locV of sprite GfxChannel to PicY
  155.   if not IsP then
  156.     updateStage()
  157.   end if
  158.   startTimer()
  159.   repeat while the timer < PauseFor
  160.     nothing()
  161.   end repeat
  162.   put "gfx done"
  163. end
  164.  
  165. on playVideo VidCast, VidX, VidY
  166.   global DVidChannel
  167.   put "playing video " & VidCast
  168.   set the movieRate of sprite DVidChannel to 0
  169.   set the castNum of sprite DVidChannel to VidCast
  170.   set the locH of sprite DVidChannel to VidX
  171.   set the locV of sprite DVidChannel to VidY
  172.   set movLength to the duration of cast VidCast
  173.   updateStage()
  174.   set slip to 0
  175.   set the movieRate of sprite DVidChannel to 1
  176.   VideoControlsOn()
  177.   puppetSprite(37, 1)
  178.   puppetSprite(38, 1)
  179.   set VCFirstCast to 60
  180.   repeat while the movieTime of sprite DVidChannel < (movLength - slip)
  181.     set percent to 100.0 * the movieTime of sprite DVidChannel / movLength
  182.     showProgress(percent)
  183.     set c to the mouseCast
  184.     if (c >= (VCFirstCast + 6)) and (c <= (VCFirstCast + 12)) then
  185.     else
  186.       if (c >= VCFirstCast) and (c <= (VCFirstCast + 5)) then
  187.         set the castNum of sprite (40 + c - VCFirstCast) to c + 6
  188.         set active to c - VCFirstCast + 1
  189.       else
  190.         set active to 0
  191.       end if
  192.     end if
  193.     if not active then
  194.       repeat with J = 0 to 4
  195.         if J <> 2 then
  196.           set the castNum of sprite (40 + J) to VCFirstCast + J
  197.           next repeat
  198.         end if
  199.         if the movieRate of sprite DVidChannel = 0 then
  200.           set the castNum of sprite (40 + J) to VCFirstCast + 6 + J
  201.           next repeat
  202.         end if
  203.         set the castNum of sprite (40 + J) to VCFirstCast + J
  204.       end repeat
  205.     end if
  206.     if the mouseDown then
  207.       put "Vid clicks " & c
  208.       set BaseVidControlCast to VCFirstCast + 6
  209.       set c to c - BaseVidControlCast
  210.       if c = 0 then
  211.         set the movieTime of sprite DVidChannel to 0
  212.       else
  213.         if c = 1 then
  214.           set HoldVol to the volume of sprite DVidChannel
  215.           set the volume of sprite DVidChannel to 1
  216.           set HoldSpeed to the movieRate of sprite DVidChannel
  217.           set the movieRate of sprite DVidChannel to -3
  218.           set the castNum of sprite 41 to VCFirstCast + 13
  219.           repeat while the mouseDown
  220.             set percent to 100.0 * the movieTime of sprite DVidChannel / movLength
  221.             showProgress(percent)
  222.             updateStage()
  223.           end repeat
  224.           set the castNum of sprite 41 to VCFirstCast + 1
  225.           set the volume of sprite DVidChannel to HoldVol
  226.           set the movieRate of sprite DVidChannel to HoldSpeed
  227.         else
  228.           if (c = 2) or (c = 5) then
  229.             set CurrSpeed to the movieRate of sprite DVidChannel
  230.             if CurrSpeed then
  231.               set the castNum of sprite 42 to BaseVidControlCast + 5
  232.               set the movieRate of sprite DVidChannel to 0
  233.               updateStage()
  234.             else
  235.               set the castNum of sprite 42 to BaseVidControlCast + 2
  236.               set the movieRate of sprite DVidChannel to 1
  237.               updateStage()
  238.             end if
  239.             repeat while the mouseDown
  240.             end repeat
  241.           else
  242.             if c = 3 then
  243.               set HoldVol to the volume of sprite DVidChannel
  244.               set the volume of sprite DVidChannel to 1
  245.               set HoldSpeed to the movieRate of sprite DVidChannel
  246.               set the movieRate of sprite DVidChannel to 6
  247.               set the castNum of sprite 43 to VCFirstCast + 15
  248.               repeat while the mouseDown
  249.                 set percent to 100.0 * the movieTime of sprite DVidChannel / movLength
  250.                 showProgress(percent)
  251.                 updateStage()
  252.               end repeat
  253.               set the castNum of sprite 43 to VCFirstCast + 3
  254.               set the volume of sprite DVidChannel to HoldVol
  255.               set the movieRate of sprite DVidChannel to HoldSpeed
  256.             else
  257.               if c = 4 then
  258.                 exit repeat
  259.               end if
  260.             end if
  261.           end if
  262.         end if
  263.       end if
  264.     end if
  265.     updateStage()
  266.     nothing()
  267.   end repeat
  268.   put "MOVIE " & VidCast & " DONE"
  269.   VideoControlsOff()
  270.   resetVideo()
  271. end
  272.  
  273. on showProgress percent
  274.   set cn to 141 + integer(percent * 13 / 100.0)
  275.   set the castNum of sprite 38 to cn
  276. end
  277.  
  278. on ShowProgress1 percent
  279.   set the locH of sprite 38 to 620
  280.   set the locV of sprite 38 to 480 - (percent / 100.0 * 480)
  281. end
  282.  
  283. on ShowProgress2 percent
  284.   set R to 6.28000000000000025 * percent / 100.0
  285.   set x to 595 + (38 * sin(R))
  286.   set y to 460 - (15 * cos(R))
  287.   set the locH of sprite 38 to x
  288.   set the locV of sprite 38 to y
  289. end
  290.  
  291. on resetVideo
  292.   global DVidChannel
  293.   set the locH of sprite DVidChannel to -300
  294.   set the locV of sprite DVidChannel to -300
  295.   set the castNum of sprite DVidChannel to 4
  296.   set the castNum of sprite 37 to 3
  297.   set the castNum of sprite 38 to 3
  298.   reCentre(37)
  299.   reCentre(38)
  300. end
  301.  
  302. on resetGfx
  303.   global GfxChannel
  304.   set the castNum of sprite GfxChannel to 3
  305.   reCentre(GfxChannel)
  306. end
  307.  
  308. on resetSeq
  309.   global SeqChannel
  310.   set the castNum of sprite SeqChannel to 3
  311.   reCentre(SeqChannel)
  312. end
  313.  
  314. on ResetRoll
  315.   global OverChannel
  316.   set the castNum of sprite OverChannel to 3
  317.   reCentre(OverChannel)
  318. end
  319.  
  320. on VideoControlsOn
  321.   global RightVis
  322.   repeat with k = 40 to 44
  323.     puppetSprite(k, 1)
  324.     set the locH of sprite k to 320
  325.     set the locV of sprite k to 240
  326.     set the castNum of sprite k to 20 + k
  327.   end repeat
  328.   set RightVis to the locH of sprite 47
  329.   set the locH of sprite 47 to 3000
  330.   set the castNum of sprite 37 to 155
  331.   set the castNum of sprite 38 to 141
  332. end
  333.  
  334. on VideoControlsOff
  335.   global RightVis
  336.   repeat with k = 40 to 44
  337.     set the castNum of sprite k to 3
  338.     puppetSprite(k, 0)
  339.   end repeat
  340.   set the castNum of sprite 37 to 3
  341.   set the castNum of sprite 38 to 3
  342.   set the locH of sprite 47 to RightVis
  343. end
  344.  
  345. on reCentre aChannel
  346.   set the locH of sprite aChannel to 320
  347.   set the locV of sprite aChannel to 240
  348. end
  349.